---
id: quickstart
title: Getting Started
slug: /getting-started/
pagination_next: getting-started/typed-linting
---

import Tabs from '@theme/Tabs';
import TabItem from '@theme/TabItem';

## Quickstart

This page is a quick-start for [ESLint's new "flat" config format](https://eslint.org/docs/latest/use/configure/configuration-files-new) to go from zero to linting with our recommended rules on your TypeScript code as quickly as possible.

:::note

- For the same guide but for [ESLint's legacy format](https://eslint.org/docs/latest/use/configure/configuration-files-deprecated) — see [Legacy ESLint Setup](./Legacy_ESLint_Setup.mdx).
- For quickstart information on linting with type information — see [Typed Linting](./Typed_Linting.mdx).

:::

### Step 1: Installation

First, install the required packages for [ESLint](https://eslint.org), [TypeScript](https://typescriptlang.org), and [our tooling](../packages/TypeScript_ESLint.mdx):

```bash npm2yarn
npm install --save-dev eslint @eslint/js typescript typescript-eslint
```

### Step 2: Configuration

Next, create an `eslint.config.mjs` config file in the root of your project, and populate it with the following:

```js title="eslint.config.mjs"
// @ts-check

import eslint from '@eslint/js';
import tseslint from 'typescript-eslint';

export default tseslint.config(
  eslint.configs.recommended,
  tseslint.configs.recommended,
);
```

This code will enable our [recommended configuration](../users/Shared_Configurations.mdx) for linting.

<details>
<summary>Aside on file extensions</summary>

The `.mjs` extension makes the file use the [ES modules (ESM)](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Guide/Modules) format. Node interprets `.js` files in the [CommonJS (CJS)](https://nodejs.org/api/modules.html) format by default, but if you have `"type": "module"` in your `package.json`, you can also use `eslint.config.js`.

</details>

#### Details

- `tseslint.config(...)` is an **_optional_** helper function — [read more about it here](../packages/TypeScript_ESLint.mdx#config).
- `'@eslint/js'` / `eslint.configs.recommended` turns on [eslint's recommended config](https://www.npmjs.com/package/@eslint/js).
- `tseslint.configs.recommended` turns on [our recommended config](../users/Shared_Configurations.mdx#recommended).

### Step 3: Running ESLint

Open a terminal to the root of your project and run the following command:

<Tabs groupId="npm2yarn">
<TabItem value="npm">

```bash
npx eslint .
```

</TabItem>
<TabItem value="Yarn">

```bash
yarn eslint .
```

</TabItem>
<TabItem value="pnpm">

```bash
pnpm eslint .
```

</TabItem>
</Tabs>

ESLint will lint all TypeScript compatible files within the current folder, and will output the results to your terminal.

## Next Steps

If you're having problems getting this working, please have a look at our [Troubleshooting & FAQs](../troubleshooting/faqs/General.mdx).

### Additional Configs

We recommend you consider enabling the following two configs:

- [`strict`](../users/Shared_Configurations.mdx#strict): a superset of `recommended` that includes more opinionated rules which may also catch bugs.
- [`stylistic`](../users/Shared_Configurations.mdx#stylistic): additional rules that enforce consistent styling without significantly catching bugs or changing logic.

```js title="eslint.config.mjs"
export default tseslint.config(
  eslint.configs.recommended,
  // Remove this line
  tseslint.configs.recommended,
  // Add this line
  tseslint.configs.strict,
  // Add this line
  tseslint.configs.stylistic,
);
```

You can read more about these in our [shared configurations docs](../users/Shared_Configurations.mdx).

### Typed Linting

We also provide a plethora of powerful rules that utilize the power of TypeScript's type information.
[Visit the next page for a typed rules setup guide](./Typed_Linting.mdx).

## Documentation Resources

- You can read more about configuring ESLint [in their documentation on configuration](https://eslint.org/docs/user-guide/configuring).
- You can read more about the rules provided by ESLint [in their documentation on their rules](https://eslint.org/docs/rules/).
- You can read more about the rules provided by typescript-eslint in our [rules documentation](/rules).
